package press.dapeng.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import press.dapeng.domain.Item;
import press.dapeng.service.itemService;

/**
 * @author dapeng
 * @create 2020-09-23 17:27
 */
@Controller
@RequestMapping("/item")
public class itemController {

    @Autowired
   private itemService itemService;

    @RequestMapping("/showItem/{id}")
    public String findById(@PathVariable("id") int id, Model model){
         Item item = itemService.findById(id);
         model.addAttribute("item",item);
         return "item";
    }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 

}
